package com.chalk.service.impl;

import com.baomidou.mybatisplus.mapper.EntityWrapper;
import com.baomidou.mybatisplus.service.impl.ServiceImpl;
import com.chalk.model.NewsType;
import com.chalk.dao.NewsTypeDao;
import com.chalk.service.NewsTypeService;

import org.springframework.stereotype.Service;

import java.util.List;

/**
 * <p>
 * 服务实现类
 * </p>
 *
 * @author glq
 * @since 2020-12-19
 */

@Service
public class NewsTypeServiceImpl extends ServiceImpl<NewsTypeDao, NewsType> implements NewsTypeService {

    @Override
    public int addNewsType(NewsType entity) {
        return baseMapper.insert(entity);
    }

    @Override
    public int updateNewsType(NewsType entity) {
        return baseMapper.updateById(entity);
    }


    @Override
    public int deleteNewsType(Integer id) {
        return baseMapper.deleteById(id);
    }

    @Override
    public List<NewsType> getNewsTypeToList() {
        //构造器
        EntityWrapper<NewsType> wrapper = new EntityWrapper<>();
        wrapper.eq("is_delete",0);
        return selectList(wrapper);
    }
}
